import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
    redirect:'/login',
    children:[
      {path: '/workspace', component: () => import('../views/workspace/WorkSpaceView.vue')},
      {path: '/vehicle', component: () => import('../views/cardealer/VehicleView.vue')},
      {path: '/carport', component: () => import('../views/cardealer/CarportView.vue')},
      {path: '/fee', component: () => import('../views/cardealer/FeeView.vue')},
      {path: '/building', component: () => import('../views/information/BuildingView.vue')},
      {path: '/house', component: () => import('../views/information/HouseView.vue')},
      {path: '/inhabitant', component: () => import('../views/information/InhabitantView.vue')},
      {path: '/bill', component: () => import('../views/payment/BillView.vue')},
      {path: '/toll', component: () => import('../views/payment/TollView.vue')},
      {path: '/meterReading', component: () => import('../views/payment/MeterReadingView.vue')},
      {path: '/instrument', component: () => import('../views/payment/InstrumentView.vue')},
      {path: '/complain', component: () => import('@/views/communityservice/ComplainView.vue')},
      {path: '/warranty', component: () => import('@/views/communityservice/WarrantyView.vue')},
      {path: '/houseDialog', component: () => import('@/views/information/HouseDialog.vue')}
    ]
  },
  {path: '/login', component: () => import('../views/LoginView')}
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router